const express = require("express");

const router = express.Router();

const expressJoi = require("@escook/express-joi");

const {
  getRoles,
  addRoles,
  getRole,
  editRole,
  delRole,
  addRight,
  delRight,
} = require("../control/roles");
// const {} = require("../schema/user");

//获取角色list
router.get("/roles", getRoles);

//添加角色
router.post("/roles", addRoles);

//根据id获取角色
router.get("/roles/:id", getRole);

//根据id获取角色
router.put("/roles/:id", editRole);

//根据id删除角色
router.delete("/roles/:id", delRole);

//角色授权
router.put("/roles/:roleId/rights", addRight);

//删除角色指定权限
router.delete("/roles/:roleId/rights/:rightId", delRight);
module.exports = router;
